var avideo_f4v_url = "http://flv.bn.netease.com/videolib3/1406/05/BoRiF2259/SD/BoRiF2259.flv";
var avideo_mp4_url = "http://221.192.146.91/flv.bn.netease.com/videolib3/1406/05/BoRiF2259/SD/BoRiF2259-mobile.mp4";
var startImg_url = "http://vimg1.ws.126.net/image/snapshot/2014/6/D/9/V9T1LM4D9.jpg";

$(function(){
    

    
    //居中标题
    $(".modal_head p").each(function(){
        var width = $(this).width();
        //var padding = $(this)[0].style.paddingLeft;
        
        width = -width / 2 - 20; //多减去padding
        width = width + "px";
        
        $(this).css({"margin-left":width});
    })
    
    
    
    $(".modal_btn").click(function(){
        
        $modal = $($(this).attr("data-modal"));
        
        
        var top = $(document).scrollTop() + 100;
        
        
        $modal.css({"top":top});
        
        //alert(top)
        
        $("#mask").removeClass("none");
        $modal.removeClass("out");
        $modal.addClass("in");
        
    })
    
    
    
    $(".modal .close").click(function(){
        $modal = $(this).parents(".modal");
        
        $modal.css({"top":""});
        $modal.removeClass("in");
        $modal.addClass("out");
        $("#mask").addClass("none");
        
        if($modal.attr("id") == "oneMinuteVideo"){
        	nie.util.pause();
        }
        
        if($modal.attr("id") == "playModal"){
            $("#playModal embed").remove();
            $("#playModal audio")[0].pause();
            
        }
        
    })
    
    nie.use(['nie.util.video',"util.share"], function() {
        
        nie.util.video($('#oneMinuteVideo .section'),{
            movieUrl:avideo_f4v_url,
            mp4_movieUrl:avideo_mp4_url,
            startImg:startImg_url,
            width:480,
            height:270,
            bufferTime:5,
            loopTimes:0,
            wmode:"opaque"
        });        
        
        
        nie.util.share({
　           fat:"#share",
　                                 type:2,
            defShow:[22,4,5,2,1],//22,4,5,2,1
            title:"#大话2寻找知音大赛#",
            content:"大话2寻找知音主播选秀大赛"
        });
        
        $(".NIE-share-txt").html("");
        
        $(".NIE-share-iconBtn a").css({"display":"block","margin-bottom":"20px","width":"50px","height":"50px"});
        $(".NIE-share2").css({"position":"absolute","top":"100px","left":"50px"});

        $(".NIE-share-btn22 img").css({"background":"url('http://res.nie.netease.com/comm/blank.gif') no-repeat"});
        $(".NIE-share-btn4 img").css({"background":"url('http://res.nie.netease.com/comm/blank.gif') no-repeat"});
        $(".NIE-share-btn5 img").css({"background":"url('http://res.nie.netease.com/comm/blank.gif') no-repeat"});
        $(".NIE-share-btn2 img").css({"background":"url('http://res.nie.netease.com/comm/blank.gif') no-repeat"});
        $(".NIE-share-btn1 img").css({"background":"url('http://res.nie.netease.com/comm/blank.gif') no-repeat"});
        $(".NIE-share-more em").css({"background":"url('http://res.nie.netease.com/comm/blank.gif') no-repeat"});    
  
        
    });
    
    
    
    
})
